var request = window.indexedDB.open("QP",2);
// var db = window.db;
request.onerror = function (event) {
  console.log(event, "数据库打开报错");
};
request.onsuccess = function (event) {
  window.db = request.result;
  console.log(event, "数据库打开成功");
};
request.onupgradeneeded = function (event) {
  window.db = event.target.result;
  var objectStore;
  if (!window.db.objectStoreNames.contains("formTempletes")) {
    objectStore = window.db.createObjectStore("formTempletes", { keyPath: "id" });
    objectStore.createIndex("name", "name", { unique: false });
    objectStore.createIndex("formTemplete", "formTemplete", { unique: false });
  }
  if (!window.db.objectStoreNames.contains("formDatas")) {
    objectStore = window.db.createObjectStore("formDatas", { keyPath: "id" });
    objectStore.createIndex("name", "name", { unique: false });
    objectStore.createIndex("data", "data", { unique: false });
  }
};
